package com.cloud.eurekahystrixconsumer.service.impl;

import com.cloud.eurekahystrixconsumer.service.ProviderService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Service;

/**
 * 熔断虚拟实现
 *
 * @author kangwen
 */
@Service
public class ProviderServiceFallback implements FallbackFactory<ProviderService> {

	@Override
	public ProviderService create(Throwable throwable) {
		return new ProviderService() {
			@Override
			public String hystrix() {
				return "Consumer hystrix response fallback " + Thread.currentThread().getName() + "-" + Thread
						.currentThread().getId();
			}

			@Override
			public String hello() {
				return "Consumer hello response fallback " + Thread.currentThread().getName() + "-" + Thread
						.currentThread().getId();
			}
		};
	}
}
